home *** CD-ROM | disk | FTP | other *** search
/ An Invitation to the Roland World of Music / Roland - An Invitation To The Roland World Of Music.bin / vb / vb30 / disk1 / drag.fr_ / drag.bin
Text File  |  1993-04-27  |  4KB  |  129 lines

  1. VERSION 2.00
  2. Begin Form frmDrag 
  3.    Caption         =   "Drag Drop"
  4.    ClientHeight    =   2670
  5.    ClientLeft      =   1500
  6.    ClientTop       =   2040
  7.    ClientWidth     =   6405
  8.    ClipControls    =   0   'False
  9.    Height          =   3075
  10.    Left            =   1440
  11.    LinkTopic       =   "Form2"
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   2670
  14.    ScaleWidth      =   6405
  15.    Top             =   1695
  16.    Width           =   6525
  17.    Begin DriveListBox Drive1 
  18.       DragIcon        =   DRAG.FRX:0000
  19.       Height          =   315
  20.       Left            =   120
  21.       TabIndex        =   2
  22.       Top             =   120
  23.       Width           =   1935
  24.    End
  25.    Begin FileListBox File1 
  26.       FontBold        =   -1  'True
  27.       FontItalic      =   0   'False
  28.       FontName        =   "System"
  29.       FontSize        =   9.75
  30.       FontStrikethru  =   0   'False
  31.       FontUnderline   =   0   'False
  32.       Height          =   2190
  33.       Left            =   2280
  34.       Pattern         =   "*.txt;*.bmp;*.exe;*.hlp"
  35.       TabIndex        =   1
  36.       Top             =   120
  37.       Width           =   2055
  38.    End
  39.    Begin DirListBox Dir1 
  40.       DragIcon        =   DRAG.FRX:0302
  41.       FontBold        =   -1  'True
  42.       FontItalic      =   0   'False
  43.       FontName        =   "System"
  44.       FontSize        =   9.75
  45.       FontStrikethru  =   0   'False
  46.       FontUnderline   =   0   'False
  47.       Height          =   1920
  48.       Left            =   120
  49.       TabIndex        =   0
  50.       Top             =   600
  51.       Width           =   1935
  52.    End
  53.    Begin Image Image1 
  54.       BorderStyle     =   1  'Fixed Single
  55.       Height          =   2415
  56.       Left            =   4560
  57.       Stretch         =   -1  'True
  58.       Top             =   120
  59.       Width           =   1725
  60.    End
  61. End
  62.  
  63. Sub Dir1_Change ()
  64.     file1.Path = Dir1.Path
  65. End Sub
  66.  
  67. Sub Drive1_Change ()
  68.     Dir1.Path = Drive1.Drive
  69. End Sub
  70.  
  71. Sub File1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  72.     file1.DragIcon = Drive1.DragIcon
  73.     file1.Drag
  74. End Sub
  75.  
  76. Sub Form_Load ()
  77.     frmDrag.Width = 6525
  78.     frmDrag.Height = 3075
  79. End Sub
  80.  
  81. Sub Image1_DragDrop (Source As Control, X As Single, Y As Single)
  82.     ' Get last three letters of the dragged filename
  83.     temp = Right$(file1.FileName, 3)
  84.     ' If dragged file is in the root, append filename.
  85.     If Mid(file1.Path, Len(file1.Path)) = "\" Then
  86.       dropfile = file1.Path & file1.FileName
  87.     ' If dragged file is not in root, append "\" and filename.
  88.     Else
  89.       dropfile = file1.Path & "\" & file1.FileName
  90.     End If
  91.       
  92.     image1.Picture = LoadPicture("")
  93.     Select Case temp
  94.     Case "txt"
  95.         X = Shell("Notepad " + dropfile, 1)
  96.     Case "bmp", "wmf", "rle", "ico"
  97.         image1.Picture = LoadPicture(dropfile)
  98.     Case "exe"
  99.         X = Shell(dropfile, 1)
  100.     Case "hlp"
  101.         X = Shell("WinHelp " + dropfile, 1)
  102.     Case Else
  103.         nl = Chr$(10) + Chr$(13)
  104.         msg = "Try one of these file types:"
  105.         msg = nl + msg + nl + nl + "     .txt, .bmp, .exe, .hlp"
  106.         MsgBox msg
  107.     End Select
  108. End Sub
  109.  
  110. Sub Image1_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
  111.     Select Case State
  112.     Case 0
  113.         ' Display a new icon when the source
  114.         ' enters the drop area.
  115.         file1.DragIcon = Dir1.DragIcon
  116.     Case 1
  117.         ' Display the original DragIcon when the source
  118.         ' leaves the drop area.
  119.         file1.DragIcon = Drive1.DragIcon
  120.     End Select
  121.  
  122. ' Note that Dir1.DragIcon and Drive1.DragIcon have been
  123. ' set at design time. This allows you to load the "Enter
  124. ' and "Leave" icons for File1 at runtime without requiring
  125. ' that the user has those icons are on disc.
  126.  
  127. End Sub
  128.  
  129.